package io.kiki.sba.registry.common.model.metaserver;

import lombok.Getter;
import lombok.Setter;

import java.util.Map;
import java.util.Set;


@Getter
public class ClientManagerAddress {

    private final long version;

    private final Map<String, AddressVersion> clientOffAddress;

    private final Set<String> reduces;

    public ClientManagerAddress(long version, Map<String, AddressVersion> clientOffAddress, Set<String> reduces) {
        this.version = version;
        this.clientOffAddress = clientOffAddress;
        this.reduces = reduces;
    }


    @Getter
    @Setter
    public static class AddressVersion {
        private long version;

        private String address;

        /**
         * true:持久化关流pub false:临时关流pub
         */
        private boolean pub = true;

        /**
         * true:持久化关流sub false:临时关流sub
         */
        private boolean sub;

        public AddressVersion(String address, boolean sub) {
            this.address = address;
            this.sub = sub;
        }

        public AddressVersion(long version, String address, boolean sub) {
            this.version = version;
            this.address = address;
            this.sub = sub;
        }


    }
}
